package com.oco.controller.user;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.common.collect.Lists;

@Controller
@RequestMapping("/v1.0/user")
public class UserController {


    @RequestMapping("/hello")  
    public String hello(
    		HttpServletRequest request,
    		Map<String, Object> model){  
        List<String> l= Lists.newArrayList(); 
        l.add("哈喽，三劫散仙");  
        //将数据存放map里面，可以直接在velocity页面，使用key访问  
        model.put("data",l);  
      
        StringBuffer requestURL = request.getRequestURL();
        String requestURI = request.getRequestURI();
        String contextPath = request.getContextPath();
        String servletPath = request.getServletPath();
        String queryString = request.getQueryString();
        model.put("requestURL", requestURL.toString());
        model.put("requestURI", requestURI);
        model.put("contextPath", contextPath);
        model.put("servletPath", servletPath);
        model.put("queryString", queryString);
        // 获取Web项目的全路径 
        String strDirPath = request.getSession().getServletContext().getRealPath("/"); 
        model.put("strDirPath", strDirPath);
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort(); 
        model.put("basePath", basePath); 
        return "hello";  
    }  
}
